<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head th:replace="components/layout :: head(~{:: title}, _, _, _)">
    <title>用户</title>
</head>
<body>

<div class="container" style="margin-top: 2em;">
    <div style="margin: 1em;">
        <button onclick="search()">刷新</button>
    </div>
    <div id="table_refresh" th:fragment="table_refresh">
        <table class="table table-bordered table-hover table-striped">
            <thead>
            <tr>
                <td>id</td>
                <td>name</td>
                <td>passwd</td>
                <td>sex</td>
            </tr>
            </thead>
            <tbody>
            <tr th:each="user: ${users}">
                <td th:text="${user.id}">123</td>
                <td th:text="${user.username}">xm</td>
                <td th:text="${user.password}">11234</td>
                <td th:text="${user.sex}">1</td>
            </tr>
            </tbody>
        </table>
    </div>
    <script>
        function search() {
            $('#table_refresh').load('/user/list', {username: 'test', sex: 1});
        }
    </script>
</div>
</body>
</html>
